package main

import (
	"database/sql"
	"fmt"
	"gitee.com/hujunil/go-geektime/week2/internal/dao"
	"github.com/pkg/errors"
)

func main() {
	fmt.Printf("第二周作业\n\n")
	userList, err := dao.UserList()
	if err != nil {
		fmt.Printf("error: %+v", err)
	}
	fmt.Printf("%v\n", userList)

	user, err := dao.FindUserByName("jake")
	if err != nil {
		if errors.Is(err, sql.ErrNoRows) {
			fmt.Printf("sql.ErrNoRows: %+v", err)
			return
		}

		fmt.Printf("其他错误 %+v", err)
		return
	}
	fmt.Printf("%+v", user)
}
